﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GoodMan.Infrastructure.Entities.Repository;

namespace GoodMan.Infrastructure.Entities.Entity
{
    public class Notice : IAccessible<T_Notice, Notice>, ILogicEntity<T_Notice, Notice>
    {
        #region 
        public int Id { get; set; }
        public string Title { get; set; }
        public string SubTitle { get; set; }
        public DateTime CreateTime { get; set; }
        public string Promulgator { get; set; }
        public string Content { get; set; }
        #endregion 

        
    
        protected override void Covariant(T_Notice model)
        {
            if (model != null)
            {
                this.Id = model.Id;
                this.Title = model.Title;
                this.SubTitle = model.SubTitle;
                this.CreateTime = model.CreateTime;
                this.Promulgator = model.Promulgator;
                this.Content = model.Content;
            }
        }

        protected override T_Notice Inverter(Notice model)
        {
            if (model != null)
            {
                return new T_Notice()
                {
                    Content = model.Content,
                    CreateTime = model.CreateTime,
                    Id = model.Id,
                    Promulgator = model.Promulgator,
                    SubTitle = model.SubTitle,
                    Title = model.Title
                };
            }
            return null;
        }

        public Notice Set(T_Notice dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
